package tables;

public class User extends AbstractEntity{
	private String password;

	static int virtualId = -1;
	
	public User(int id, String name, String password){
		super(id, name);
		this.password = password;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	//********* virtualId tools *********\\
	public static void initalizeVirtualId(int realVirtualId){
		virtualId = realVirtualId;
	}
	
	public static int getVirtualId() {
		return virtualId;
	}
	
	public static void addVirtualId(){
		virtualId++;
	}
	
	public static boolean isInitalized(){
		if(virtualId < 0){
			return false;
		}else{
			return true;
		}
	}
	
	public int fixId(){
		if(!isValidId()){
			addVirtualId();
			setId(getVirtualId());
		}
		return getId();
	}
	
	public String toString(){
		return super.toString() + "password: " + getPassword() + "\n";
	}

	
}
